package com.zhijian.warehouse.manage.enums;

/**
 * 库存操作
 * @Author 王小宇
 * @Version 1.0.1
 */
public class StockActionEnum {
    
    /**
     * 库存操作类型
     */
    public enum ACTION_TYPE {

        STOCK_IN(1, "产品入库", StoreEnum.IN_OUT_TYPE.IN.getCode()),
        STOCK_OUT(2, "产品出库", StoreEnum.IN_OUT_TYPE.OUT.getCode()),
        CHECK_IN(3, "盘赢入库", StoreEnum.IN_OUT_TYPE.IN.getCode()),
        CHECK_OUT(4, "盘亏出库", StoreEnum.IN_OUT_TYPE.OUT.getCode()),
        ALLOT_IN(5, "调拨入库", StoreEnum.IN_OUT_TYPE.IN.getCode()),
        ALLOT_OUT(6, "调拨出库", StoreEnum.IN_OUT_TYPE.OUT.getCode()),
        ;
        public int value;
        public String msg;
        /**
         * 减少库存为负1 增加库存为正1
         */
        public int genre;
        
        ACTION_TYPE(int value, String msg, int genre) {
            this.value = value;
            this.msg = msg;
            this.genre = genre;
        }
        
        public static ACTION_TYPE getByValue(int value) {
            ACTION_TYPE[] flags = ACTION_TYPE.values();
            for (ACTION_TYPE flag : flags) {
                if (flag.value == value)
                    return flag;
            }
            return null;
        }
    }
    
    /**
     * 库存操作类型
     */
    public enum OPT_SOURCE {

        WEB(1, "web"),
        APP(2, "app"),
        ;
        public int value;
        public String msg;

        OPT_SOURCE(int value, String msg) {
            this.value = value;
            this.msg = msg;
        }
        
        public static OPT_SOURCE getByValue(int value) {
            OPT_SOURCE[] flags = OPT_SOURCE.values();
            for (OPT_SOURCE flag : flags) {
                if (flag.value == value)
                    return flag;
            }
            return null;
        }
    }
}
